﻿using Common;
using FluentScheduler;

namespace ImageWeb
{
    /// <summary>
    /// 定时清空web项目的Images文件夹中的内容
    /// </summary>
    public class ScheduleJob : Registry
    {
        public ScheduleJob()
        {
            Schedule<MyJob>().ToRunEvery(1).Days().At(3, 0);//每天凌晨3点
            //Schedule<MyJob>().ToRunNow().AndEvery(1).Weeks().At(3, 0);//每周一凌晨3点执行
        }
    }

    public class MyJob : IJob
    {
        void IJob.Execute()
        {
            string path = System.Web.Hosting.HostingEnvironment.MapPath("~/Images");
            PublicMethod.DelectDir(path);
        }
    }

}